//
//  HJYJBaseViewController.swift
//  jiuzhoudai
//
//  Created by zhaochengfeng on 2025/7/8.
//

import UIKit
import MBProgressHUD



extension HJYJBaseViewController: UIGestureRecognizerDelegate {
    func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        if let count = navigationController?.viewControllers.count, count > 1 {
            return true
        }
        return false
    }
}

class HJYJBaseViewController: UIViewController {
    
    var jqfxhIsNavBarjjHidden: Bool = false

    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .white
        hidesBottomBarWhenPushed = true
        let jqfxhBackItem = UIBarButtonItem(image: .init(named: "jqfxh_nav_black_back"), style: .plain, target: self, action: #selector(jqfxhBackBarkkAction))
        navigationItem.leftBarButtonItem = jqfxhBackItem
        
        
        if #available(iOS 13.0, *) {
            let jqfxhAppearance = UITabBarAppearance()
            jqfxhAppearance.configureWithOpaqueBackground()
            jqfxhAppearance.backgroundColor = UIColor.white

            UITabBar.appearance().standardAppearance = jqfxhAppearance
            if #available(iOS 15.0, *) {
                UITabBar.appearance().scrollEdgeAppearance = jqfxhAppearance
            }
        }
    }
    
    @objc func jqfxhBackBarkkAction() {
         jqfxhClosellSelf(animated: true)
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        navigationController?.setNavigationBarHidden(jqfxhIsNavBarjjHidden, animated: animated)
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
    }
    
    
    func jqfxhClosellSelf(animated: Bool) {
        navigationController?.popViewController(animated: animated)
    }
    
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        navigationController?.interactivePopGestureRecognizer?.delegate = self
    }
    
    

}


